package book;
public class BookList {
    private Book [] books;//表示书架可以存放10本书
    private int usedbooks;//表示books数组中存放了几本书

    public BookList() {
        this.books = new Book [10];  //默认创建存放10本书大小的数组
        this.books[0]=new Book("三国演义","罗贯中",20,"四大名著");
        this.books[1]=new Book("西游记","吴承恩",22,"四大名著");
        this.books[2]=new Book("红楼梦","曹雪芹",24,"四大名著");
        this.books[3]=new Book("水浒传","施耐庵",26,"四大名著");
        this.usedbooks=4;//初始化有效书本数量为4本
    }
    public int getUsedbooks() {
        return usedbooks;//返回有效书本数量
    }
    public void setUsedbooks(int usedbooks) {
        this.usedbooks = usedbooks;//更改有效书本数量
    }
    public Book getbook(int pos){
        return this.books[pos];  //返回书架中 第pos本书
    }
    public void setBooks(int pos,Book book){
        this.books[pos]=book;  //更改书架中的书
    }
}
